home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / emulator / bsvc-1.000 / bsvc-1 / bsvc-1.0.4 / src / SimHector / devices / RAM.scr < prev    next >
Encoding:
Text File  |  1995-07-26  |  4.2 KB  |  93 lines

  1. "#!/usr/local/bin/wish -f\n"
  2. "###############################################################################\n"
  3. "# $Id: RAM.tcl,v 1.2 1994/08/22 07:39:34 bmott Exp $\n"
  4. "###############################################################################\n"
  5. "# This Tcl script gets the setup information for the RAM device.\n"
  6. "#\n"
  7. "# Notes: - All Procedures and global variables begin with \"DeviceSetup\".  This\n"
  8. "#          should be true for all device scripts.\n"
  9. "#        - The toplevel window should be .device for all device scripts.\n"
  10. "#        - The script must return a valid argument for the device's\n"
  11. "#          constructor. (i.e. \"BaseAddress=00000000 Size=00000000\")\n"
  12. "#        - If the cancel button is pressed the empty string should be\n"
  13. "#          returned\n"
  14. "#        - All device scripts should be modal dialogs\n"
  15. "#\n"
  16. "# Copyright (c) 1993\n"
  17. "# By: Bradford W. Mott\n"
  18. "# October 30,1993\n"
  19. "###############################################################################\n"
  20. "# $Log: RAM.tcl,v $\n"
  21. "# Revision 1.2  1994/08/22  07:39:34  bmott\n"
  22. "# Made the dialog a little more user friendly and changed the names of\n"
  23. "# some of the device arguments\n"
  24. "#\n"
  25. "# Revision 1.1  1994/02/18  20:15:27  bmott\n"
  26. "# Initial revision\n"
  27. "#\n"
  28. "###############################################################################\n"
  29. "proc DeviceSetupGetValues {} {\n"
  30. "  set base [.device.inputs.entry.address get]\n"
  31. "  set size [.device.inputs.entry.size get]\n"
  32. "  set result \"BaseAddress=$base Size=$size\"\n"
  33. "  return \"$result\"\n"
  34. "}\n"
  35. "proc DeviceSetupCheckValues {} {\n"
  36. "  set base [.device.inputs.entry.address get]\n"
  37. "  set size [.device.inputs.entry.size get]\n"
  38. "  if {[regexp {^[0-9A-Fa-f]+$} $base] && [regexp {^[0-9A-Fa-f]+$} $size]} {\n"
  39. "    destroy .device \n"
  40. "  } else {\n"
  41. "    \n"
  42. "  }\n"
  43. "}\n"
  44. "###############################################################################\n"
  45. "# This is the procedure the User Interface calls\n"
  46. "###############################################################################\n"
  47. "proc DeviceSetup {} {\n"
  48. "  global DeviceSetupReturnValue\n"
  49. "  catch {destroy .device}\n"
  50. " \n"
  51. "  toplevel .device\n"
  52. "  wm title .device \"RAM Setup\"\n"
  53. "  wm iconname .device \"RAM Setup\"\n"
  54. "  message .device.message \
  55.     -text \"Please enter the base address and size of the RAM.\\n\\nAll values are in hexadecimal!\" \
  56.     -width 3i -justify left\n"
  57. "  frame .device.inputs -relief ridge -borderwidth 2\n"
  58. "    frame .device.inputs.label\n"
  59. "      label .device.inputs.label.address -text \"Base Address:\"\n"
  60. "      label .device.inputs.label.size -text \"Size:\"\n"
  61. "      pack .device.inputs.label.address -side top \n"
  62. "      pack .device.inputs.label.size -side right\n"
  63. "    frame .device.inputs.entry\n"
  64. "      entry .device.inputs.entry.address -width 10 -relief sunken\n"
  65. "      bind .device.inputs.entry.address \
  66.           <Return> { focus .device.inputs.entry.size }\n"
  67. "      entry .device.inputs.entry.size -width 10 -relief sunken\n"
  68. "      bind .device.inputs.entry.size \
  69.           <Return> { focus .device.inputs.entry.address }\n"
  70. "      pack .device.inputs.entry.address -side top -fill x -expand 1 -pady 2\n"
  71. "      pack .device.inputs.entry.size -side top -fill x -expand 1 -pady 2\n"
  72. "    pack .device.inputs.label -side left \n"
  73. "    pack .device.inputs.entry -side left -fill x -expand 1 -padx 2\n"
  74. "  frame .device.buttons\n"
  75. "    button .device.buttons.ok -text \"Okay\" \
  76.       -command {set DeviceSetupReturnValue [DeviceSetupGetValues]\n"
  77. "                DeviceSetupCheckValues}\n"
  78. "    button .device.buttons.cancel -text \"Cancel\" \
  79.       -command {set DeviceSetupReturnValue \"\"; destroy .device}\n"
  80. "    pack .device.buttons.ok -side left -expand 1 -fill x -padx 4\n"
  81. "    pack .device.buttons.cancel -side right -expand 1 -fill x -padx 4\n"
  82. "  pack .device.message -side top -fill x -pady 4 -padx 4\n"
  83. "  pack .device.inputs -side top -fill x -pady 2 -padx 4 -ipady 2\n"
  84. "  pack .device.buttons -side top -fill x -pady 4\n"
  85. "  # Set input focus to the first entry widget\n"
  86. "  tkwait visibility .device\n"
  87. "  focus .device.inputs.entry.address\n"
  88. "  # Make this a modal dialog\n"
  89. "  grab set .device\n"
  90. "  tkwait window .device\n"
  91. "  return $DeviceSetupReturnValue\n"
  92. "}\n"
  93.